package cn.wit.front.service.impl;


import cn.wit.front.mapper.CurriculumMapper;
import cn.wit.front.mapper.ProjectExerciseMapper;
import cn.wit.front.mapper.TechPointMapper;
import cn.wit.front.service.TechPointService;
import cn.wit.utils.pojo.TechPoint;
import cn.wit.utils.response.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

@Service
public class TechPointServiceImpl implements TechPointService {
    @Autowired
    private TechPointMapper techPointMapper;
    @Autowired
    private CurriculumMapper curriculumMapper;
    @Autowired
    private ProjectExerciseMapper projectExerciseMapper;



    @Override
    public Result selectAllTechPoint() {
        List<TechPoint> techPoints = techPointMapper.selectList(null);
        if (!CollectionUtils.isEmpty(techPoints)) {
            return Result.ok(techPoints);
        }
        return Result.ok(new ArrayList<>());
    }

    @Override
    public Result selectAllPage(IPage<TechPoint> page) {
        IPage<TechPoint> techPointIPage = techPointMapper.selectPage(page, null);
        return Result.ok(techPointIPage);
    }
}
